import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  ManyToOne,
} from "typeorm";
import { Conversation } from "./conversation.entity";
@Entity()
export class Message {
  @PrimaryGeneratedColumn("uuid") id: string;
  @ManyToOne(() => Conversation, (c) => (c as any).messages, {
    onDelete: "CASCADE",
  })
  conversation: Conversation;
  @Column() senderId: string;
  @Column("text") content: string;
  @CreateDateColumn() createdAt: Date;
}
